import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './css/global.css'
import './plugins/data-view.js'


// 使用vuex进行保存全局数据
import vuex from 'vuex'
Vue.use(vuex)

// 使用axios进行请求数据
import axios from 'axios'
axios.defaults.baseURL = "https://www.lovespace.cloud/api"
//axios.defaults.baseURL = "http://47.105.118.98:8085"

axios.interceptors.request.use(
  // 配置token
  config => {
    config.headers.token = store.state.token;
    return config;
  },
  error => {
    console.log("err");
    return Promise.reject(error);
  }
);
/* axios.interceptors.response.use(function (response) {
  while (response.data.code != 200) {
    this.$router.push("/404");
  }
  return response;
}, function (error) {
  console.log("err");
  return Promise.reject(error);
}); */


Vue.prototype.$axios = axios;



// 引入elementui
import './plugins/elements'
import 'element-ui/lib/theme-chalk/index.css';
import './css/elementuiyanse.less'

// 引入echarts图表
import echarts from 'echarts'
Vue.prototype.$echarts = echarts


Vue.config.productionTip = false


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
